package com.eshipenet.shipnet.edgeboxextbuilder
import org.apache.flink.streaming.api.scala._
import play.api.libs.json.{JsObject, Json}

class EdgeBoxModelActionJsonStreamProvider {

  def edgeBoxModelActionJsonStream(env: StreamExecutionEnvironment): DataStream[JsObject] = {
    env.fromCollection(
      List(
        Json.obj(
          "schema" -> Json.obj(),
          "payload" -> Json.obj(
            "ts_ms" -> 1,
            "op"    -> "i",
            "after" -> Json.obj(
              "id"       -> "1",
              "name"     -> "m1",
              "channels" -> Json.arr(),
            )
          )
        ),
        Json.obj(
          "schema" -> Json.obj(),
          "payload" -> Json.obj(
            "ts_ms" -> 1,
            "op"    -> "i",
            "after" -> Json.obj(
              "id"       -> "2",
              "name"     -> "m1",
              "channels" -> Json.arr(),
            )
          )
        ),
        Json.obj(
          "schema" -> Json.obj(),
          "payload" -> Json.obj(
            "ts_ms" -> 1,
            "op"    -> "u",
            "before" -> Json.obj(
              "id"       -> "1",
              "name"     -> "m2",
              "channels" -> Json.arr(),
            ),
            "after" -> Json.obj(
              "id"       -> "1",
              "name"     -> "m1",
              "channels" -> Json.arr(),
            )
          )
        )
      ))
  }

}
